/*
Copyright 2014, KISSY v1.47
MIT Licensed
build time: May 22 12:30
*/
KISSY.add("scroll-view/plugin/scrollbar/scrollbar-xtpl",[],function(){return function(d){var a;a=this.config.utils;var e=a.renderOutput,f=a.getProperty,h=a.runInlineCommand,b=a.getPropertyOrRunCommand;a='<div id="ks-scrollbar-arrow-up-';var c=b(this,d,{},"id",0,1);a+=e(c,!0);a+='"\n        class="';var c={},g=[],i=f(this,d,"axis",0,2);g.push(i+"-arrow-up");c.params=g;c=h(this,d,c,"getBaseCssClasses",2);a+=e(c,!0);a+='">\n    <a href="javascript:void(\'up\')">up</a>\n</div>\n<div id="ks-scrollbar-arrow-down-';
c=b(this,d,{},"id",0,5);a+=e(c,!0);a+='"\n        class="';c={};g=[];i=f(this,d,"axis",0,6);g.push(i+"-arrow-down");c.params=g;c=h(this,d,c,"getBaseCssClasses",6);a+=e(c,!0);a+='">\n    <a href="javascript:void(\'down\')">down</a>\n</div>\n<div id="ks-scrollbar-track-';c=b(this,d,{},"id",0,9);a+=e(c,!0);a+='"\n     class="';c={};g=[];i=f(this,d,"axis",0,10);g.push(i+"-track");c.params=g;c=h(this,d,c,"getBaseCssClasses",10);a+=e(c,!0);a+='">\n<div id="ks-scrollbar-drag-';b=b(this,d,{},"id",0,11);a+=
e(b,!0);a+='"\n     class="';b={};c=[];g=f(this,d,"axis",0,12);c.push(g+"-drag");b.params=c;b=h(this,d,b,"getBaseCssClasses",12);a+=e(b,!0);a+='">\n<div class="';b={};c=[];g=f(this,d,"axis",0,13);c.push(g+"-drag-top");b.params=c;b=h(this,d,b,"getBaseCssClasses",13);a+=e(b,!0);a+='">\n</div>\n<div class="';b={};c=[];g=f(this,d,"axis",0,15);c.push(g+"-drag-center");b.params=c;b=h(this,d,b,"getBaseCssClasses",15);a+=e(b,!0);a+='">\n</div>\n<div class="';b={};c=[];f=f(this,d,"axis",0,17);c.push(f+"-drag-bottom");
b.params=c;d=h(this,d,b,"getBaseCssClasses",17);a+=e(d,!0);return a+'">\n</div>\n</div>\n</div>'}});
KISSY.add("scroll-view/plugin/scrollbar/render",["component/control","./scrollbar-xtpl"],function(d,a){var e=a("component/control"),f=a("./scrollbar-xtpl"),h=d.Features.isTransform3dSupported(),b={beforeCreateDom:function(a,b){a.elCls.push(a.prefixCls+"scrollbar-"+a.axis);d.mix(b,{dragEl:"#ks-scrollbar-drag-{id}",downBtn:"#ks-scrollbar-arrow-down-{id}",upBtn:"#ks-scrollbar-arrow-up-{id}",trackEl:"#ks-scrollbar-track-{id}"})},createDom:function(){var a=this.control;a.$dragEl=a.get("dragEl");a.$trackEl=
a.get("trackEl");a.$downBtn=a.get("downBtn");a.$upBtn=a.get("upBtn");a.dragEl=a.$dragEl[0];a.trackEl=a.$trackEl[0];a.downBtn=a.$downBtn[0];a.upBtn=a.$upBtn[0]},_onSetDragHeight:function(a){this.control.dragEl.style.height=a+"px"},_onSetDragWidth:function(a){this.control.dragEl.style.width=a+"px"},_onSetDragLeft:function(a){this.control.dragEl.style.left=a+"px"},_onSetDragTop:function(a){this.control.dragEl.style.top=a+"px"}};if(!1!==d.Features.getVendorCssPropPrefix("transform")){var c=d.Features.getVendorCssPropName("transform");
b._onSetDragLeft=function(a){this.control.dragEl.style[c]="translateX("+a+"px) translateY("+this.control.get("dragTop")+"px)"+(h?" translateZ(0)":"")};b._onSetDragTop=function(a){this.control.dragEl.style[c]="translateX("+this.control.get("dragLeft")+"px) translateY("+a+"px)"+(h?" translateZ(0)":"")}}return e.getDefaultRender().extend(b,{ATTRS:{contentTpl:{value:f}}})});
KISSY.add("scroll-view/plugin/scrollbar/control",["node","component/control","./render"],function(d,a){function e(a){a.preventDefault()}function f(a){a.stopPropagation();a.isTouch||a.preventDefault();this.get("disabled")||(this.startMousePos=a[this.pageXyProperty],this.startScroll=this.scrollView.get(this.scrollProperty),m.on(j.move,h,this).on(j.end,b,this))}function h(a){var b=this.scrollView,c={};c[this.scrollType]=this.startScroll+(a[this.pageXyProperty]-this.startMousePos)/this.trackElSize*this.scrollLength;
b.scrollToWithBounds(c)}function b(){m.detach(j.move,h,this).detach(j.end,b,this)}function c(){var a=this.scrollView,b=this.trackEl,c=this.scrollWHProperty,d=this.whProperty,g=this.clientWHProperty,e=this.dragWHProperty;a.allowScroll[this.scrollType]?(this.scrollLength=a[c],b=this.trackElSize="width"===d?b.offsetWidth:b.offsetHeight,a=a[g]/this.scrollLength,a*=b,this.set(e,a),this.barSize=a,n(this),this.set("visible",!0)):this.set("visible",!1)}function g(a){this.set("disabled",a.newVal)}function i(){this.hideFn&&
o(this)}function k(){var a=this.scrollView;a.allowScroll[this.scrollType]&&(l(this),this.set("visible",!0),this.hideFn&&!a.isScrolling&&o(this),n(this))}function q(a){function b(){var a={};a[g]=c.get(d)+h*e;c.scrollToWithBounds(a)}if(!this.get("disabled")){a.halt();var c=this.scrollView,d=this.scrollProperty,g=this.scrollType,e=c.getScrollStep()[this.scrollType],a=a.target,h=a===this.downBtn||this.$downBtn.contains(a)?1:-1;clearInterval(this.mouseInterval);this.mouseInterval=setInterval(b,100);b()}}
function r(a){if(!this.get("disabled")){var b=a.target,c=this.$dragEl;if(!(this.dragEl===b||c.contains(b))){var b=this.scrollType,c=this.scrollView,d=Math.max(0,(a[this.pageXyProperty]-this.$trackEl.offset()[b]-this.barSize/2)/this.trackElSize),g={};g[b]=d*this.scrollLength;c.scrollToWithBounds(g);a.halt()}}}function s(){clearInterval(this.mouseInterval)}function n(a){var b=a.scrollType,c=a.scrollView,d=a.dragLTProperty,g=a.dragWHProperty,e=a.trackElSize,h=a.barSize,f=a.scrollLength,i=c.get(a.scrollProperty),
k=c.minScroll[b],b=c.maxScroll[b];i>b?(e*=b/f,a.set(g,h-(i-b)),a.set(d,e+h-a.get(g))):i<k?(e*=k/f,a.set(g,h-(k-i)),a.set(d,e)):(a.set(d,i/f*e),a.set(g,h))}function o(a){l(a);a.hideTimer=setTimeout(a.hideFn,1E3*a.get("hideDelay"))}function l(a){a.hideTimer&&(clearTimeout(a.hideTimer),a.hideTimer=null)}var p=a("node"),m=p.all(document),t=a("component/control"),u=a("./render"),j=p.Gesture;return t.extend({initializer:function(){var a=this.scrollType="x"===this.get("axis")?"left":"top",b=d.ucfirst(a);
this.pageXyProperty="left"===a?"pageX":"pageY";a=this.whProperty="left"===a?"width":"height";a=d.ucfirst(a);this.afterScrollChangeEvent="afterScroll"+b+"Change";this.scrollProperty="scroll"+b;this.dragWHProperty="drag"+a;this.dragLTProperty="drag"+b;this.clientWHProperty="client"+a;this.scrollWHProperty="scroll"+a;this.scrollView=this.get("scrollView")},bindUI:function(){var a=this,b=a.get("autoHide"),h=a.scrollView;b?a.hideFn=d.bind(a.hide,a):(d.each([a.$downBtn,a.$upBtn],function(b){b.on(j.start,
q,a).on(j.end,s,a)}),a.$trackEl.on(j.start,r,a),a.$dragEl.on("dragstart",e).on(j.start,f,a));h.on(a.afterScrollChangeEvent+".ks-scrollbar",k,a).on("scrollEnd.ks-scrollbar",i,a).on("afterDisabledChange.ks-scrollbar",g,a).on("reflow.ks-scrollbar",c,a)},syncUI:function(){c.call(this)},destructor:function(){this.scrollView.detach(".ks-scrollbar");l(this)}},{ATTRS:{minLength:{value:20},scrollView:{},axis:{view:1},autoHide:{value:d.UA.ios},visible:{valueFn:function(){return!this.get("autoHide")}},hideDelay:{value:0.1},
dragWidth:{setter:function(a){var b=this.get("minLength");return a<b?b:a},view:1},dragHeight:{setter:function(a){var b=this.get("minLength");return a<b?b:a},view:1},dragLeft:{view:1,value:0},dragTop:{view:1,value:0},dragEl:{},downBtn:{},upBtn:{},trackEl:{},focusable:{value:!1},xrender:{value:u}},xclass:"scrollbar"})});
KISSY.add("scroll-view/plugin/scrollbar",["base","./scrollbar/control"],function(d,a){function e(){var a=this.scrollView,c=this.get("minLength"),d=this.get("autoHideX"),e=this.get("autoHideY"),f;!this.scrollBarX&&a.allowScroll.left&&(f={axis:"x",scrollView:a,elBefore:a.$contentEl},void 0!==c&&(f.minLength=c),void 0!==d&&(f.autoHide=d),this.scrollBarX=(new h(f)).render());!this.scrollBarY&&a.allowScroll.top&&(f={axis:"y",scrollView:a,elBefore:a.$contentEl},void 0!==c&&(f.minLength=c),void 0!==e&&(f.autoHide=
e),this.scrollBarY=(new h(f)).render())}var f=a("base"),h=a("./scrollbar/control");return f.extend({pluginId:this.getName(),pluginBindUI:function(a){this.scrollView=a;a.on("reflow",e,this)},pluginDestructor:function(a){this.scrollBarX&&(this.scrollBarX.destroy(),this.scrollBarX=null);this.scrollBarY&&(this.scrollBarY.destroy(),this.scrollBarY=null);a.detach("reflow",e,this)}},{ATTRS:{minLength:{},autoHideX:{},autoHideY:{}}})});
